<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue的事件修饰符</title>
</head>
<body>
  <div id="app">
    <h3>{{num}}</h3>
    <div @click="num++">
      测试冒泡
      <input type="button" value="添加" @click.stop="add(10,$event)">
    </div>
    <h3>
      <a href="http://www.ztu.edu.cn" target="_blank" @click.prevent="open">点击打开连接</a>
    </h3>
  </div>
  <script src="vue.js"></script>
  <script>
    const vm  = new Vue({
      el:"#app",
      data:{
        num:10
      },
      methods:{
        add(n,e) {
          this.num+=n
          //阻止事件冒泡
          //e.stopPropagation();
        },
        open(e) {
          this.num+=100
          //阻止默认行为
          //e.preventDefault();
        }
      }
    })
  </script>
</body>
</html>